<?php
/**
 * CreateTime: 2023/11/15 10:17
 * User:LinQ
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            // 数据库基本配置
            $table->engine = 'InnoDB';
            $table->unique('goods_uuid','idx_goods_uuid');
            // 数据库字段
            $table->id('goods_id')->comment("商品id");
            $table->integer('com_id')->comment("公司id");
            $table->decimal('goods_price',18,3)->comment("商品价格");
            $table->string('goods_show_image_id')->comment("商品展示图id");
            $table->string('goods_image_ids')->comment("商品图片,隔开");
            $table->string('goods_name')->nullable(false)->comment("商品名称");
            $table->string('goods_simple_name')->nullable(false)->comment("商品简称");
            $table->string('goods_brand')->nullable(false)->comment("商品品牌");
            $table->string('shipping_location_info')->nullable(false)->comment("发货信息");
            $table->string('belonging_works')->nullable(false)->comment("所属作品");
            $table->integer('sales_method')->default(1)->nullable(false)->comment("售卖方式 1一口价 2拼团");
            $table->integer('sales_method_number')->nullable(true)->comment("拼团的话 需要填写这个字段");
            $table->string('goods_uuid')->nullable(false)->comment("商品uuid");
            $table->integer('goods_status')->nullable(false)->comment("商品状态");
            $table->integer('group_id')->default(0)->nullable(false)->comment("商品组id 0默认最高");
            $table->integer('goods_type_id')->nullable(false)->comment("商品类型id");
            $table->string('goods_describe')->nullable(true)->comment("商品描述");
            $table->integer('owner_id')->nullable(false)->comment("创建人");
            $table->integer('goods_stock')->nullable(false)->comment("商品库存数量");
            $table->integer('stock_status')->nullable(false)->comment("库存状态 1.现货 2预收");
            $table->timestamp('stock_start_time')->nullable(true)->comment("预售开始时间");
            $table->integer('enable_status')->default(2)->nullable(false)->comment("商品上架状态 1上架 2下架");
            $table->integer('status')->nullable(false)->comment("基础状态");

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
};
